Add OPENSIM_DISABLE_STATIC_TYPE_REGISTRATION cmake option#4012
Add OPENSIM_DISABLE_STATIC_TYPE_REGISTRATION cmake option#4012adamkewley merged 1 commit intomainfrom
Conversation
nickbianco
left a comment
There was a problem hiding this comment.
LGTM, but requesting a review from @aymanhab since (I think) he wrote the instantiators originally and may have some comments.
aymanhab
left a comment
There was a problem hiding this comment.
Thanks @adamkewley that looks reasonable, especially that the default behavior is unchanged.
Reviewed 12 of 12 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @adamkewley)
CMakeLists.txt line 193 at r1 (raw file):
on using by calling `RegisterTypes_osimLIBRARY` (e.g. `RegisterTypes_osimActuators`), or by manually registering each type (e.g. `Object::registerType(PhysicalOffsetFrame());`)." OFF) mark_as_advanced(OPENSIM_DISABLE_STATIC_TYPE_REGISTRATION)
Will this show in cmake popup? Great explanation but maybe too verbose for a popup? Maybe something like turn it on only if you'll load the libraries explicitly in your code? but your call.
I haven't used the native Although it's verbose, I figured it's probably the best place to document it because it has the dual benefit of documenting the compile define for people who I can try and make it shorter. |
620c6a5 to
d60aea1
Compare
|
Merging: I force-pushed a shorter docstring but left the rest intact so that there's one commit for the whole change (which is easier to reverse if there's problems post-merge) thanks @aymanhab @nickbianco |
This is a patch I've been applying downstream in opensim-creator that I figured might be useful for opensim-core.
This adds an
OPENSIM_DISABLE_STATIC_TYPE_REGISTRATIONcmakeoptionthat can be toggledONto build OpenSim without the static-init-time instantiator classes.The motivation for doing this is:
osimActuators.dlldepends onosimCommon.dll, so the dynamic loader just happens to load one before the other - this may fail if they are merged into one binary. It may also fail if (e.g.) the log is statically initialized after a static registration function that writes to the log (a segfault I encountered with OpenSim Creator).Brief summary of changes
OPENSIM_DISABLE_STATIC_TYPE_REGISTRATIONtoCMakeLists.txtTesting I've completed
Looking for feedback on...
CHANGELOG.md (choose one)
This change is